<template>
  <div class="journalism_img">
    <div class="journalism_box">
      <div class="swiper">
        <swiper ref="mySwiper" :options="swiperOptions">
          <swiper-slide v-for="(item, index) in silde" :key="index">
            <div class="journalism_box_slide">
              <div class="journalism_box_slide_img">
                <img :src="item.img" alt="" />
              </div>
              <div class="journalism_box_slide_name">{{ item.name }}</div>
              <div class="journalism_box_slide_time">{{ item.time }}</div>
            </div>
          </swiper-slide>
          <div class="swiper-pagination" slot="pagination"></div>
        </swiper>
      </div>
    </div>
  </div>
</template>
<script>
import "../assets/swiper/dist/css/swiper.css";
import { swiper, swiperSlide } from "vue-awesome-swiper";

export default {
  components: { swiper, swiperSlide },
  props: {
    silde: {
      type: Array,
      default: [],
    },
  },
  data() {
    return {
      swiperOptions: {
        loop: true,
        autoplay: {
          delay: 3000,
          disableOnInteraction: false,
        },
        // slidesOffsetBefore: 25, // 距离左边框的偏移量
        slidesPerView: 3,
        pagination: {
          el: ".swiper-pagination", // 与slot="pagination"处 class 一致
          clickable: true, // 轮播按钮支持点击
        },
      },
    };
  },
  computed: {
    swiper() {
      return this.$refs.swiperLogin.swiper;
    },
  },
};
</script>
<style scoped>
.journalism_img {
  width: 100%;
  padding-top: 10%;
  height: 40%;
  background-image: url("../assets/image/header_image.png");
  background-size: contain;
  background-repeat: no-repeat;
}
.journalism_box {
  display: flex;
  width: calc(70% + 30px);
  height: calc(70% - 10px);
  margin: auto;
  overflow: hidden;
}
.journalism_box_slide {
  /* width: ; */
  margin: 0 4% !important;
  color: aliceblue;
  position: relative;
  box-shadow: 0px 8px 20px rgba(54, 85, 165, 0.08);
  border: 0.5% solid rgb(255, 255, 255);
}
.journalism_box_slide img {
  width: 100%;
  z-index: -1;
}
.journalism_box_slide_img {
  border-top: 10px solid #fff;
  border-left: 10px solid #fff;
  border-right: 10px solid #fff;
  border-bottom: 5px solid #fff;
}
.journalism_box_slide_name {
  margin-left: 8%;
  position: absolute;
  bottom: 22%;
}
.journalism_box_slide_time {
  margin-left: 8%;
  position: absolute;
  bottom: 12%;
  z-index: 1000;
  color: #fff;
}
/* swiper样式 */
.journalism_box .swiper {
  width: 100%;
}

.journalism_box .swiper .swiper-container {
  width: 100%;
}

.journalism_box .swiper .swiper-container .swiper-slide {
  width: 33.3% !important;
  padding-bottom: 2%;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;

  /* Center slide text vertically */
  display: -webkit-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  -webkit-align-items: center;
  align-items: center;
}

.journalism_box
  .swiper
  .swiper-container
  .swiper-pagination
  .swiper-pagination-bullet-active {
  background-color: #f29b76;
}
.swiper-pagination-fraction,
.swiper-pagination-custom,
.swiper-container-horizontal > .swiper-pagination-bullets {
  bottom: -5px;
}
</style>
